Interfacing of temperature sensor LM35 with Arduino
INSTRUCTIONS
Step-1(Info.)
1.)
Source
2.)
Target
Note:
Make Connections First, Then move to the code Compilation
Step-2 (Connections)
1.)Drag and drop BreadBoard,Arduino and all other Components first.
2.)Connect
Pin (Vcc)
of LCD with
Pin 2
of breadboard..
3.)Connect
Pin (Gnd)
of LCD with
Pin 1
of breadboard..
4.)Connect
Pin (SCL)
of LCD with
Pin A4
of Arduino..
5.)Connect
Pin (SDA)
of LCD with
Pin A5
of Arduino..
6.)Connect
Pin (Vcc)
of LM35 with
Pin 4
of BreadBoard..
7.)Connect
Pin (Gnd)
of LM35 with
Pin 3
of BreadBoard..
8.)Connect
Pin (Vo)
of LM35 with
Pin (A1)
of Arduino..
9.)Connect
Pin 5
of Breadboard with
GND Pin
of Arduino..
10.)Connect
Pin 6
of Breadboard with
Pin (5V)
of Arduino..
11.)Click on
"CHECK"
button to check the connections.
Step-3 (Code Compilation)
1.) Set float millivolts = ________ as
"sensorValue"
2.) Set float temperatureC = ________ as
"millivolts"
;
3.) click on
"COMPILE"
button to run and compile the code.
4.) Right click on
LM35 sensor
and set the range of
temperature from -55 deg celsius to 150 deg celsius .
Components
LCD
LM35
Arduino
BreadBoard
3
4
1
2
6
5
Vcc
Vo
GND
Bread Board
00
millivolt
LCD
Vcc
GND
SCL
SDA
LM35
Temperature:
0
Deg Celcius
Arduino UNO
Code Compiler
#
include
<
LiquidCrystal.h
>
const int
lm35Pin = A0;
LiquidCrystal
lcd
(12, 11, 5, 4, 3, 2);
void
setup() {
lcd.
begin
(16, 1);
Serial.
begin
(9600);
}
void
loop() {
int
sensorValue =
analogRead
(lm35Pin);
float
millivolts = (
/ 1024.0) * 5000.0;
float
temperatureC =
/ 10.0;
lcd.
clear
();
lcd.
setCursor
(0, 0);
lcd.
print
(millivolts);
lcd.
print
(": millivolt");
Serial.
print
(" millivolt: ");
Serial.
print
(millivolts);
delay
(1000);
}
CHECK
RESET
COMPILE
PRINT
© 2024 | Virtual Labs, IIT Roorkee